﻿using Razor.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Razor.Controllers
{
    public class HomeController : Controller
    {

        Product myProduct = new Product
        {
            ProductID = 1,
            Name = "Kayak姓名",
            Description = "A bot for one person 描述",
            Category = "watersports",
            Price = 275M
        };

        // GET: Home
        public ActionResult Index()
        {
            return View(myProduct);
        }
        // GET: Home2
        public ActionResult Index2()
        {
            return View(myProduct);
        }


        public ActionResult NameNadPrice()
        {
            return View(myProduct);
        }

        //插入数据值
        public ActionResult DemoExpression()
        {
            ViewBag.ProductCount = 0;
            ViewBag.ExpressShip = true;
            ViewBag.ApplyDiscount = false;
            ViewBag.Supplier = null;
            return View(myProduct);
        }

        //枚举数组和集合
        public ActionResult DemoArray()
        {
            Product[] array =
            {
                new Product{Name="Kayak",Price=275M},
                new Product{Name="LifeJacket",Price=48.95M},
                new Product{Name="Soccer ball",Price=19.5M},
                new Product{Name="Corner flage",Price=34.95M},
                new Product{Name="Pingpan",Price=108M}
            };
            return View(array);
        }

        //枚举数组和集合
        public ActionResult DemoArray2()
        {
            Product[] array =
            {
                new Product{Name="Kayak",Price=275M},
                new Product{Name="LifeJacket",Price=48.95M},
                new Product{Name="Soccer ball",Price=19.5M},
                new Product{Name="Corner flage",Price=34.95M},
                new Product{Name="Pingpan",Price=108M}
            };
            return View(array);
        }
    }
}